package Game;

import java.awt.Color;
import java.awt.Graphics2D;
import java.util.Random;

public abstract class Level extends Scene 
{
	public static boolean ganhou, perdeu, saiu;
	
	public static Caminho caminho;
	
	static GameImage cenario;
	
	protected static Random r = new Random();
		
	public Level()
	{
		Start();
	}
	
	@Override
	public void Update() 
	{
		CartaManager.Update();
		
		HUD.Update();
		
		EffectManager.Update();
		
		EnemyManager.Update();
		
		AllyManager.Update();
		
		ItemManager.Update();
		
		MoneyManager.Update();
		
		PeopleManager.Update();
	}
	
	@Override
	public void Draw(Graphics2D g2d)
	{
		background.Draw(g2d);
		
		cenario.Draw(g2d);
		
		CartaManager.Draw(g2d);
		
		PeopleManager.Draw(g2d);
		
		EnemyManager.Draw(g2d);
		
		AllyManager.Draw(g2d);
		
		EffectManager.Draw(g2d);
		
		ItemManager.Draw(g2d);
		
		MoneyManager.Draw(g2d);
		
		HUD.Draw(g2d);
	}
	
	public void Restart()
	{
		Start();
	}
	
	private void Start()
	{
		ganhou = false;
		perdeu = false;
		saiu = false;
		
		background = new GameImage(0, 0, TowerDefense.screenWidth, TowerDefense.screenHeight, Color.gray);
		background.Load("/Images/square.png");
		
		caminho = new Caminho(4, 4, TowerDefense.screenWidth - 150, TowerDefense.screenHeight - 100);
		
		cenario = new GameImage(0, 0);
		cenario.Load("/Images/cenario1.png");
		
		CartaManager.Setup();
		EffectManager.Setup();
		AllyManager.Setup();
		ItemManager.Setup();
		HUD.Setup();
		PeopleManager.Setup();
		MoneyManager.Setup();
	}
}